package com.indusfo.spc.controller;

import com.indusfo.spc.aspect.SystemControllerLog;
import com.indusfo.spc.pojo.BadreplyType;
import com.indusfo.spc.service.BadreplyTypeService;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 不良对策类控制层
 */
@Controller
@RequestMapping("/service/badreplyType")
public class BadreplyTypeController {


    @Autowired
    private BadreplyTypeService badreplyTypeService;

    /**
     * 更新不良对策类
     *
     * @param badreplyType
     * @return com.indusfo.spc.vo.JSONObject
     */
    @RequestMapping(value="/updateBadreplyType", method= RequestMethod.POST)
    @SystemControllerLog(description="修改不良对策类")
    @ResponseBody
    public JSONObject updateBadreplyType(BadreplyType badreplyType) {
        JSONObject json = badreplyTypeService.updateBadreplyType(badreplyType);
        return json;
    }

    /**
     * 插入
     *
     * @param badreplyType
     * @return com.indusfo.spc.vo.JSONObject
     */
    @RequestMapping(value="/insertBadreplyType", method= RequestMethod.POST)
    @SystemControllerLog(description="新增部门")
    @ResponseBody
    public JSONObject insertBadreplyType(BadreplyType badreplyType) {
        JSONObject json = badreplyTypeService.insertBadreplyType(badreplyType);
        return json;
    }

    /**
     * 查询不良对策类树
     *
     * @param badreplyType
     * @return com.indusfo.spc.vo.JSONObject
     */
    @RequestMapping(value="/queryBadreplyTypeTree")
    @SystemControllerLog(description="查询不良对策类树")
    @ResponseBody
    public JSONObject queryBadreplyTypeTree(BadreplyType badreplyType) {
        JSONObject json = badreplyTypeService.detpsTree(badreplyType);
        return json;
    }

    /**
     * 查询子类不良对策类
     *
     * @param badreplyType
     * @return com.indusfo.spc.vo.JSONObject
     */
    @RequestMapping(value="/queryBadreplyType")
    @SystemControllerLog(description="查询子类不良对策类")
    @ResponseBody
    public JSONObject queryBadreplyType(BadreplyType badreplyType) {
        JSONObject json = badreplyTypeService.queryBadreplyType(badreplyType);
        return json;
    }

    /**
     * 删除
     *
     * @param ids
     * @return com.indusfo.spc.vo.JSONObject
     */
    @RequestMapping(value="/deleteBadreplyType", method= RequestMethod.POST)
    @SystemControllerLog(description="删除不良对策类")
    @ResponseBody
    public JSONObject deleteBadreplyType(Long[] ids) {
        JSONObject json = badreplyTypeService.deleteBadreplyType(ids);
        return json;
    }

}
